#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 10;
ll a[N];

void solve() {
	int n, q; cin >> n >> q;
	for (int i = 1; i <= n; i++) cin >> a[i];
	while (q--) {
		int x; cin >> x;
		int l = 0, r = n + 1;
		while (l + 1 < r) {
			int mid = (l + r) >> 1;
			if (a[mid] >= x) r = mid;
			else l = mid;
		}
		if (a[r] == x) cout << r << " ";
		else cout << -1 << " ";
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	solve();
	return 0;
}